<?php $curPage = $this->config->site_url() . $this->uri->uri_string(); ?>
<script type="text/javascript">
    function nextQuestion(clicked_id){
        //alert(clicked_id);
        $.post(base_url+"site/set_csr",
        {
            csr_id: clicked_id
        },
        function(str){
            //alert(str);
            if(str=="succ"){
                //alert("succeed"+str);
                window.location.replace(base_url+"site/questionnaire");
            }else{
                window.location.replace(base_url+"site/customer_service");
            }
        }
    );
    }
</script>
<div class="post">
    <div class ="box_container">
        <h2 class="title">Kuesioner Pelayanan Plasa Telkom</h2><br/>
        <?php if (count($csrs) > 0) { ?>
            <span id="questionContent" class="usualText">Siapakah CSR yang tadi melayani Anda ?</span>
            <div class="thumb-wrapper">
                <ul>
                    <?php
                    foreach ($csrs as $csr) {
                        ?>
                        <li onclick="nextQuestion('<?php echo $csr['csr_id'] ?>')" id=<?php echo $csr['csr_id'] ?>>
                            <span class="thumb ">
                                <div class="thumb-img">
                                    <?php
                                    if (file_exists(PATH_TO_CSR_PHOTO . DIRECTORY_SEPARATOR . $csr['csr_id'] . CSR_EXTENSION)) {
                                        echo "<img src=" . base_url() . PATH_TO_CSR_PHOTO_SITE . $csr['csr_id'] . CSR_EXTENSION . "?" . rand() . ">";
                                    } else {
                                        echo "<img src=" . base_url() . PATH_TO_CSR_PHOTO_SITE . CSR_DEFAULT_PHOTO . CSR_EXTENSION . "?" . rand() . ">";
                                    }
                                    ?>
                                </div>
                                <div class="thumb-label"><?php echo $csr['csr_name'] ?></div>
                            </span>
                        </li>
                    <?php } ?>
                </ul>
            </div>

        <?php } else { ?>
            <div class="clearboth"></div>
            <div class="usualText">Tidak ada data CSR. Silakan kembali ke awal</div><br/>
            <div><a href="site"><button type="button" class="button" value="">Kembali ke awal</button></a></div>
        <?php } ?>
    </div>
</div>
